<?php

/**
 * GameArmor form base class.
 *
 * @method GameArmor getObject() Returns the current form's model object
 *
 * @package    aiontoolskit
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseGameArmorForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                => new sfWidgetFormInputHidden(),
      'item_type'         => new sfWidgetFormChoice(array('choices' => array('abyss' => 'abyss', 'devanion' => 'devanion', 'draconic' => 'draconic', 'normal' => 'normal'))),
      'icon_name'         => new sfWidgetFormInputText(),
      'equipment_slots'   => new sfWidgetFormChoice(array('choices' => array('foot' => 'foot', 'glove' => 'glove', 'head' => 'head', 'leg' => 'leg', 'shoulder' => 'shoulder', 'sub' => 'sub', 'torso' => 'torso', 'torso glove foot shoulder leg' => 'torso glove foot shoulder leg'))),
      'quality_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('GameItemQuality'), 'add_empty' => false)),
      'level'             => new sfWidgetFormInputText(),
      'gender_permitted'  => new sfWidgetFormChoice(array('choices' => array('all' => 'all', 'female' => 'female', 'male' => 'male'))),
      'option_slot_bonus' => new sfWidgetFormInputText(),
      'bonus_apply'       => new sfWidgetFormInputText(),
      'no_enchant'        => new sfWidgetFormInputCheckbox(),
      'faction_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('GameFaction'), 'add_empty' => false)),
      'bonus_attr1'       => new sfWidgetFormInputText(),
      'bonus_attr2'       => new sfWidgetFormInputText(),
      'bonus_attr3'       => new sfWidgetFormInputText(),
      'bonus_attr4'       => new sfWidgetFormInputText(),
      'bonus_attr5'       => new sfWidgetFormInputText(),
      'bonus_attr6'       => new sfWidgetFormInputText(),
      'bonus_attr7'       => new sfWidgetFormInputText(),
      'bonus_attr8'       => new sfWidgetFormInputText(),
      'bonus_attr9'       => new sfWidgetFormInputText(),
      'bonus_attr10'      => new sfWidgetFormInputText(),
      'bonus_attr11'      => new sfWidgetFormInputText(),
      'bonus_attr12'      => new sfWidgetFormInputText(),
      'armor_type'        => new sfWidgetFormChoice(array('choices' => array('chain' => 'chain', 'clothes' => 'clothes', 'leather' => 'leather', 'no_armor' => 'no_armor', 'plate' => 'plate', 'robe' => 'robe'))),
      'dodge'             => new sfWidgetFormInputText(),
      'magical_resist'    => new sfWidgetFormInputText(),
      'physical_defend'   => new sfWidgetFormInputText(),
      'block'             => new sfWidgetFormInputText(),
      'damage_reduce'     => new sfWidgetFormInputText(),
      'reduce_max'        => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'                => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'item_type'         => new sfValidatorChoice(array('choices' => array(0 => 'abyss', 1 => 'devanion', 2 => 'draconic', 3 => 'normal'), 'required' => false)),
      'icon_name'         => new sfValidatorString(array('max_length' => 40, 'required' => false)),
      'equipment_slots'   => new sfValidatorChoice(array('choices' => array(0 => 'foot', 1 => 'glove', 2 => 'head', 3 => 'leg', 4 => 'shoulder', 5 => 'sub', 6 => 'torso', 7 => 'torso glove foot shoulder leg'), 'required' => false)),
      'quality_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('GameItemQuality'))),
      'level'             => new sfValidatorInteger(array('required' => false)),
      'gender_permitted'  => new sfValidatorChoice(array('choices' => array(0 => 'all', 1 => 'female', 2 => 'male'), 'required' => false)),
      'option_slot_bonus' => new sfValidatorInteger(array('required' => false)),
      'bonus_apply'       => new sfValidatorString(array('max_length' => 9, 'required' => false)),
      'no_enchant'        => new sfValidatorBoolean(array('required' => false)),
      'faction_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('GameFaction'))),
      'bonus_attr1'       => new sfValidatorString(array('max_length' => 32, 'required' => false)),
      'bonus_attr2'       => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'bonus_attr3'       => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'bonus_attr4'       => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'bonus_attr5'       => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'bonus_attr6'       => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'bonus_attr7'       => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'bonus_attr8'       => new sfValidatorString(array('max_length' => 22, 'required' => false)),
      'bonus_attr9'       => new sfValidatorString(array('max_length' => 22, 'required' => false)),
      'bonus_attr10'      => new sfValidatorString(array('max_length' => 22, 'required' => false)),
      'bonus_attr11'      => new sfValidatorString(array('max_length' => 22, 'required' => false)),
      'bonus_attr12'      => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'armor_type'        => new sfValidatorChoice(array('choices' => array(0 => 'chain', 1 => 'clothes', 2 => 'leather', 3 => 'no_armor', 4 => 'plate', 5 => 'robe'), 'required' => false)),
      'dodge'             => new sfValidatorInteger(array('required' => false)),
      'magical_resist'    => new sfValidatorInteger(array('required' => false)),
      'physical_defend'   => new sfValidatorInteger(array('required' => false)),
      'block'             => new sfValidatorInteger(array('required' => false)),
      'damage_reduce'     => new sfValidatorInteger(array('required' => false)),
      'reduce_max'        => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('game_armor[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'GameArmor';
  }

}
